
#include "tp2.h"


void sierpinski_c    (
	unsigned char *src,
	unsigned char *dst,
	int cols,
	int filas,
	int src_row_size,
	int dst_row_size)
{
	unsigned char (*src_matrix)[src_row_size] = (unsigned char (*)[src_row_size]) src;
	unsigned char (*dst_matrix)[dst_row_size] = (unsigned char (*)[dst_row_size]) dst;
	int i, j, k;
	float coef;

	for (i = 0; i < filas; i++) {
		k= -1;
		for (j = 0; j < cols*4; j++) {
			if (j % 4 == 0) {
				k ++;
				coef = (1 / 255.0) * ((int)((i / (float)filas) * 255.0) ^ ((int)(k / (float)cols * 255.0)));
			}
			dst_matrix[i][j] = (unsigned char)(src_matrix[i][j] * coef);
		}
		j= 0;
    }

}


